]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
shell/app: Re-order running-state cleanup
authorFlorian Müllner <fmuellner@gnome.org>
Wed, 22 Dec 2021 00:53:17 +0000 (01:53 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Wed, 22 Dec 2021 00:55:05 +0000 (01:55 +0100)
Since commit 1807be1, we clear the fallback icon when a window is
removed, and notify the icon change. The notify call currently
happens after removing the window from the running state, but
before syncing the state (and possibly clear the running state
altogether).

That state is inconsistent and results in an assertion hit when
some code tries to re-fetch the icon in response to the notify
call.

Address this by updating the state before clearing the fallback
icon, so that the app will be in the correct STOPPED state after
removing the last window.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4888

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2073>

src/shell-app.c

index 28e819a05ae029abb2352039e7ee1f8d89f26b2c..587b4a4edb32a85f11b2ab3698ca4fcc50cb1507 100644 (file)
@@ -1140,6 +1140,13 @@ _shell_app_remove_window (ShellApp   *app,
 
   app->running_state->windows = g_slist_remove (app->running_state->windows, window);
 
+  if (!meta_window_is_skip_taskbar (window))
+    app->running_state->interesting_windows--;
+  shell_app_sync_running_state (app);
+
+  if (app->running_state->windows == NULL)
+    g_clear_pointer (&app->running_state, unref_running_state);
+
   g_signal_handlers_disconnect_by_func (window, G_CALLBACK(shell_app_on_user_time_changed), app);
   g_signal_handlers_disconnect_by_func (window, G_CALLBACK(shell_app_on_skip_taskbar_changed), app);
   if (window == app->fallback_icon_window)
@@ -1152,15 +1159,8 @@ _shell_app_remove_window (ShellApp   *app,
       g_object_notify (G_OBJECT (app), "icon");
     }
 
-  if (!meta_window_is_skip_taskbar (window))
-    app->running_state->interesting_windows--;
-  shell_app_sync_running_state (app);
-
   g_object_unref (window);
 
-  if (app->running_state->windows == NULL)
-    g_clear_pointer (&app->running_state, unref_running_state);
-
   g_signal_emit (app, shell_app_signals[WINDOWS_CHANGED], 0);
 }